#ifndef HASIO_IP_TCP_HPP
#define HASIO_IP_TCP_HPP

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#include "../basic_stream_socket.hpp"
#include "basic_endpoint.hpp"
#include "../detail/socket_types.hpp"
#include "../basic_socket_acceptor.hpp"

namespace hasio {
namespace ip {

class tcp
{
public:
    using socket = basic_stream_socket<tcp>;
    using endpoint = basic_endpoint<tcp>;
    using acceptor = basic_socket_acceptor<tcp>;

    tcp() = default;

    static tcp v4()
    {
        return tcp(SOCKET_DEF(AF_INET));
    }

    static tcp v6()
    {
        return tcp(SOCKET_DEF(AF_INET6));
    }

    int type() const
    {
        return SOCKET_DEF(SOCK_STREAM);
    }

    int protocol() const
    {
        return SOCKET_DEF(IPPROTO_TCP);
    }

    int family() const
    {
        return family_;
    }
private:
    explicit tcp(int family)
        : family_(family)
    {
    }
private:
    int family_;
};

}
}

#endif // HASIO_IP_TCP_HPP